<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 创建promise实例
        const p1 = new Promise((resolve,reject)=>{
            console.log('开始请求数据......');
            try{
                // throw new Error('错误啦')
                // 使用定时器,模拟ajax请求
                setTimeout(()=>{
                    console.log('wo成功获取啦');
                    resolve('好了')
                },1000)
            }catch(e){
                reject(e.message)
                console.log(e.message);
            }
        })
        console.log('p1',p1);
    </script>
</body>
</html>